Skip to content

fix(sign): use stub ASCII value in CSR subject to handle non-ASCII identities - #1714

Open
xovishnukosuri wants to merge 1 commit into
sigstore:mainfrom
xovishnukosuri:fix/non-ascii-csr-subject
Open

xovishnukosuri wants to merge 1 commit into
sigstore:mainfrom
xovishnukosuri:fix/non-ascii-csr-subject

Conversation

@xovishnukosuri

Copy link
Copy Markdown

Summary

Fixes #1507.

When a GitHub Actions OIDC token has a sub claim containing non-ASCII characters (e.g. an environment name with an emoji), the CSR built in Signer._signing_cert embeds that value as the EMAIL_ADDRESS subject attribute. Since that attribute is encoded as an IA5String (ASCII-only), this produces an invalid DER structure and Fulcio returns a 400.

Per sigstore/fulcio#863, Fulcio ignores the CSR subject field entirely and derives the certificate identity from the OIDC token. So the subject value in the CSR has no effect on what Fulcio issues.

This PR replaces the identity claim in the CSR subject with the fixed stub "user@example.com", which is always valid ASCII, making signing work regardless of what the identity claim contains.

Changes

  • sigstore/sign.py: use "user@example.com" as the CSR EMAIL_ADDRESS subject instead of self._identity_token._identity
  • test/unit/test_sign.py: add a regression test that constructs a signer with a non-ASCII emoji in the identity and verifies the CSR subject is the stub value

Release Note

Fixed signing failure when the OIDC identity claim contains non-ASCII characters (e.g. emojis in GitHub Actions environment names). The CSR subject is now a fixed stub value since Fulcio does not use it.

…entities

Fulcio ignores the CSR subject field entirely and derives the certificate
identity from the OIDC token directly. Embedding the actual identity claim
in the CSR's EMAIL_ADDRESS attribute causes failures when the claim contains
non-ASCII characters (e.g. emojis in GitHub Actions environment names), since
the field is encoded as IA5String which only allows ASCII.

Replace the identity value with a fixed stub "user@example.com" so that CSR
construction succeeds regardless of the claim content.

Fixes sigstore#1507

Signed-off-by: Vishnu Kosuri <xovishnukosuri@gmail.com>

@woodruffw woodruffw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the CSR subject is entirely ignored (I think you're right that it is), we should probably just send a CSR with a completely empty subject or with something very obviously ignored, like THIS_VALUE_IS_IGNORED, rather than a plausible looking email identity like user@example.com.

But separately: the fact that we're able to encode an invalid IA5String here strongly suggests a bug in PyCA Cryptography; PyCA Cryptography should either reject the CSR generation or switch to a UTF8String when the given value isn't representable as an IA5String. The latter probably wouldn't be standard though, so rejecting seems right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sigstore-python generates invalid CSRs when identity claim isn't ASCII

2 participants